﻿using System;
using System.Collections.Generic;
using System.Text;

namespace homework_8
{
    class orderdetail
    {
        public string ProductName { get; set; }
        public int ProductNum { get; set; }

        public int ProductSum { get; set; }
        public orderdetail(string productName, int productNum,int productSum)
        {
            ProductName = productName;
            ProductNum = productNum;
            ProductSum = productSum;
        }


        public override bool Equals(object obj)
        {
            return obj is orderdetail details &&
                   ProductName == details.ProductName &&
                   ProductNum == details.ProductNum &&
                   ProductSum == details.ProductSum;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(ProductName, ProductNum);
        }

        public override string ToString()
        {
            return $"商品名称：{ProductName} 商品数量：{ProductNum} 商品金额：{ProductSum}";
        }

    }

}
